import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class a1{
    static class A implements Comparable{
        public int l,r;
        A(){l=0;r=0;}
        A(int a,int b){l=Math.min(a,b);r=Math.max(a,b);}
        public int compareTo1(Object o){
            A t=(A)o;
            if(l>t.l && r>t.r) return 1;
            if(l==t.l && r==t.r) return 0;
            return -1;
        }
        public int compareTo(Object o){
            A t=(A)o;
            int a=l*r,b=t.l*t.r;
            if(a>b) return 1;
            if(a==b) return 0;
            return -1;
        }
    }
    /*
    [[5,4],[6,3],[6,7],[6,6]]
    */
    public static void main(String[] args) {
        try {
           List<A> list=new ArrayList<>();
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String s =br.readLine();
            s=s.substring(1,s.length()-1);
            //System.out.println(s);
            String[] s1=s.split("],");
            for(String s2: s1){
                String s3=s2.replace("]","").replace("[","");
                String[] s4=s3.split(",");
                list.add(new A(Integer.parseInt(s4[0]),Integer.parseInt(s4[1])));
            }
            // for(A a:list){
            //     System.out.println(a.l+" "+a.r);
            // }
            // System.out.println();
            Collections.sort(list);
            int ans=0,len=list.size();
            A pre=list.get(len-1);
            for(int i=len-2;i>=0;i--){
                A a=list.get(i);
                if(a.compareTo(pre)==-1){
                    ans++;
                }else 
                    break;
            }
            System.out.println(ans);
        } catch (Exception e) {
            //TODO: handle exception
            System.out.println("error");
        }
        
    }




}